package com.cn.thread.common;

import java.util.Random;

public class Producer extends Thread {
    private BufferResources bufferResources;
    Random random = new Random();

    //构造时需要指定缓冲区
    public Producer(BufferResources bufferResources) {
        this.bufferResources = bufferResources;
    }

    @Override
    public void run() {
        //生产
        this.bufferResources.product(random.nextInt());
    }
}

